<?php
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Methods:POST,GET,PUT,DELETE');
header('Access-Control-Allow-Headers:x-requested-with,Content-Type,X-CSRF-Token');


$userid = $_REQUEST["userid"]; //手机号
header("content-type:text/html;charset=utf-8");
// 1. 连接数据库
$mysqli = new Mysqli("localhost", "root", "root", "db_jiuji");
mysqli_query($mysqli, "set names 'utf8'"); // 解决数据库查询乱码问题
// 2. 判断数据库是否连接成功
if ($mysqli->connect_errno) {
    die();
};
// 3. 写SQL语句
$sql = "select dl_password from user where dl_cellphone={$userid}";
$result = $mysqli->query($sql);
if ($result->num_rows) {
    $row = $result->fetch_assoc();
    print_r(json_encode($row));
//    header("refresh:.5;url=http://localhost/jiuji/index.html");
} else {
    echo "0";
}
